//package com.zhangdi.mgsync.core.aspect;
//
//import com.zhangdi.mgsync.core.annotation.AlertMessage;
//import com.zhangdi.mgsync.core.message.EmailUtil;
//import lombok.extern.slf4j.Slf4j;
//import org.aspectj.lang.JoinPoint;
//import org.aspectj.lang.annotation.AfterThrowing;
//import org.aspectj.lang.annotation.Aspect;
//import org.aspectj.lang.annotation.Pointcut;
//import org.aspectj.lang.reflect.MethodSignature;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//
//import java.lang.reflect.Method;
//
///**
// * @author zhangdi
// * @version 1.0
// * @date 2023.6.16
// */
//@Slf4j
//@Component
//@Aspect
//public class AlertMessageHandlerAspect {
//    @Autowired
//    EmailUtil emailUtil;
//
//    @Pointcut("@annotation(com.zhangdi.mgsync.core.annotation.AlertMessage)")
//    public void pointcut() {
//    }
//
//    @AfterThrowing(pointcut = "@annotation(com.zhangdi.mgsync.core.annotation.AlertMessage)", throwing = "e")
//    public void handler(JoinPoint joinPoint, Exception e) {
//        MethodSignature signature = (MethodSignature) joinPoint.getSignature();
//        Method method = signature.getMethod();
//        AlertMessage annotation = method.getAnnotation(AlertMessage.class);
//        emailUtil.send(annotation.name(), e.getMessage());
//    }
//}
